package com.xkstream.client.config;

import com.xkstream.client.R;

/**
 * Created by xiaoyi on 2018-1-16.
 */

public class LevelConfig {
    private static int[] levels = {
            10,
            60,
            150,
            300,
            500,
            750,
            1000,
            1400,
            1900,
            2300,
            2900,
            3500,
            4200,
            5000,
            5800,
            6700,
            7700,
            8800,
            10000,
            11200,
            12600,
            14000,
            15600,
            17300,
            19000,
            20900,
            22900,
            25100,
            27300,
            29700,
            32200,
            34900,
            37700,
            40700,
            43800,
            47100,
            50600,
            54300,
            58100,
            62100,
            66400,
            70800,
            75400,
            80300,
            85400,
            90700,
            96300,
            102000,
            108000,
            115000,
            121000,
            128000,
            135000,
            143000,
            151000,
            159000,
            168000,
            176000,
            186000,
            195000,
            205000,
            216000,
            227000,
            238000,
            250000,
            262000,
            275000,
            288000,
            302000,
            316000,
            331000,
            346000,
            362000,
            378000,
            395000,
            413000,
            432000,
            451000,
            470000,
            491000,
            512000,
            534000,
            557000,
            581000,
            605000,
            630000,
            657000,
            684000,
            712000,
            741000,
            771000,
            802000,
            834000,
            868000,
            902000,
            938000,
            975000,
            1010000,
            1050000,
            1100000
    };

    private static int[] levelZone = {
        15,30,45,60,70,80,90,100
    };

    private static int[] levelBgRes = {
            R.drawable.level_0_15,
            R.drawable.level_16_30,
            R.drawable.level_31_45,
            R.drawable.level_46_60,
            R.drawable.level_61_70,
            R.drawable.level_71_80,
            R.drawable.level_81_90,
            R.drawable.level_91_100,
    };

    public  static int getLevel(int exp){
        int level=0;
        for (int i = 0; i < levels.length; i++) {
            if (exp<levels[i]){
                level = i;
                break;
            }
        }
        return level;
    }

    public static int getLevelBgRes(int level){
        int index = 0;
        for (int i = 0; i < levelZone.length; i++) {
            if (level<=levelZone[i]){
                index  = i;
                break;
            }
        }
        return levelBgRes[index];
    }
}
